package behaviorPattern.observer;

public class CurrentConditionDisplay implements Observer, DisplayElement{
    private float temperature;
    private float pressure;
    private float humidity;

    public CurrentConditionDisplay(WeatherData weatherData) {
        weatherData.registerObserver(this);
    }

    @Override
    public void display() {
        System.out.println("CurrentConditionDisplay: \n" + "temperature: " + this.temperature +"\n" +
            "humidity:" + this.humidity + "\n"+
            "pressure: " + this.pressure+ "\n" +
            ">>>>>>>>>>>>>>>>>>>>>>>>>>");
    }

    @Override
    public void update(float temp, float humidity, float pressure) {
        this.temperature = temp;
        this.humidity = humidity;
        this.pressure = pressure;

        display();
    }
}
